package com.yyw.indecatorviewpager;

import android.app.Activity;
import android.util.DisplayMetrics;

/**
 * Created by yyw on 2016/12/30.
 */

public class DensityUtils {
    public static int dp2pex(int dp, Activity activity){
        DisplayMetrics displayMetrics = new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        float density = displayMetrics.density;
        return (int)(dp*density+0.5);

    }
}
